package com.cmwa.solution.business.product.service.impl;


import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cmwa.solution.base.entity.Page;
import com.cmwa.solution.base.entity.SearchParam;
import com.cmwa.solution.business.product.dao.TreNavBizDao;
import com.cmwa.solution.business.product.entity.TreNavBizVo;
import com.cmwa.solution.business.product.service.TreNavBizService;

/**
 * 招商财富产品净值表业务实现层
 * 
 * @author ex-zhengqq
 * @date 2019-01-22 15:33:47
 */
@Service
public class TreNavBizServiceImpl implements TreNavBizService {
	
	@Resource
	private TreNavBizDao treNavBizDao;

	@Override
	public List<Map<String,Object>> navBizInfoByCode(String prdCode,String limit) {
		return treNavBizDao.navBizInfoByCode(prdCode,limit);
	}

	@Override
	public TreNavBizVo findNavBizData(String prdCode) {
		return treNavBizDao.findNavBizData(prdCode);
	}

	@Override
	public Page<TreNavBizVo> treNavListPage(SearchParam sp) {
		List<TreNavBizVo> items = treNavBizDao.treNavListPage(sp);
		return Page.create(items, sp.getStart(), sp.getLimit(), sp.getTotal());
	}

	@Override
	public void saveTreNav(TreNavBizVo treNavBizVo) {
		treNavBizDao.insertTreNav(treNavBizVo);
	}

	@Override
	public TreNavBizVo treNavDetail(String navBizId) {
		return treNavBizDao.treNavDetail(navBizId);
	}

	@Override
	public void delTreNavById(String navBizId) {
		treNavBizDao.delTreNav(navBizId);
	}

	@Override
	public void updateTreNav(TreNavBizVo treNavBizVo) {
		treNavBizDao.updateTreNav(treNavBizVo);
	}

	@Override
	public boolean isRepeat(String navBizId,String subPrdCode, String assessmentDate) {
		int count = treNavBizDao.getCount(navBizId,subPrdCode,assessmentDate);
		return count > 0;
	}


}
